From bc5688b66a81ecf868e14dd80f4f992bf8c9007e Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 11 Aug 2006 14:22:54 +0100 Subject: [PATCH] [NET] front: Do not allocate unnecessary page-sized main data area for receive skbuffs. The bulk data is stored in fragments. Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index 6bad0c4909..1556d2299c 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -609,9 +609,14 @@ static void network_alloc_rx_buffers(struct net_device *dev) */ batch_target = np->rx_target - (req_prod - np->rx.rsp_cons); for (i = skb_queue_len(&np->rx_batch); i < batch_target; i++) { - /* Allocate an skb and a page. */ - skb = __dev_alloc_skb(RX_COPY_THRESHOLD, - GFP_ATOMIC | __GFP_NOWARN); + /* + * Allocate an skb and a page. Do not use __dev_alloc_skb as + * that will allocate page-sized buffers which is not + * necessary here. + * 16 bytes added as necessary headroom for netif_receive_skb. + */ + skb = alloc_skb(SKB_DATA_ALIGN(RX_COPY_THRESHOLD + 16), + GFP_ATOMIC | __GFP_NOWARN); if (unlikely(!skb)) goto no_skb; -- 2.30.2